package mil.af.amc.adpetracker.web.helpers;

import mil.af.amc.adpetracker.model.Organization;
import mil.af.amc.adpetracker.service.OrganizationService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Collections;
import java.util.List;

/**
 * ViewHelper implementation for Organization objects
 *
 * @author TSgt Jason Ferguson
 */
@Service("organizationViewHelper")
public class OrganizationViewHelper {

    private OrganizationService organizationService;

    @Autowired
    public void setOrganizationService(OrganizationService organizationService) {
        this.organizationService = organizationService;
    }

    public List<Organization> getAll() {

        List<Organization> results = organizationService.getAll();
        Collections.sort(results);
        return results;
    }

}
